package com.imti.mall.sale.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.imti.mall.model.sms.pojo.SmsHomeNewProduct;
import com.imti.mall.model.sms.pojo.SmsHomeRecommendProduct;
import com.imti.mall.model.sms.vo.SmsHomeRecommendProductPicVo;
import com.imti.mall.sale.mapper.SmsHomeNewProductMapper;
import com.imti.mall.sale.mapper.SmsHomeRecommendProductMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;

@Mapper
public interface SmsHomeRecommendProductDao extends BaseMapper<SmsHomeRecommendProduct> {

    /**
     * 查询人气推荐商品表
     */
    @SelectProvider(type= SmsHomeRecommendProductMapper.class,method = "findSmsHomeRecommendProduct")
    public List<SmsHomeRecommendProduct> findSmsHomeRecommendProduct (SmsHomeRecommendProduct smsHomeRecommendProduct);

    /**
     * 修改人气推荐商品表
     * @param smsHomeRecommendProduct
     * @return
     */
    @UpdateProvider(type= SmsHomeRecommendProductMapper.class,method = "updateSmsHomeRecommendProduct")
    public Integer updateSmsHomeRecommendProduct(SmsHomeRecommendProduct smsHomeRecommendProduct);

    @Select("SELECT shnrp.*,pp.pic,pp.price FROM sms_home_recommend_product shnrp INNER JOIN pms_product pp ON  shnrp.product_id=pp.id")
    public List<SmsHomeRecommendProductPicVo> findSmsHomeRecommendProductPic(SmsHomeRecommendProductPicVo smsHomeRecommendProductPicVo);
}
